package com.lagou.sqlSession;

import com.lagou.pojo.Configuration;
import com.lagou.pojo.MappedStatement;

import java.sql.SQLException;
import java.util.List;

/**
 * 执行器接口
 *
 * @author user
 */
public interface Executor {

    /**
     * 查询
     *
     * @param configuration   配置
     * @param mappedStatement mapped
     * @param params          参数
     * @param <E>             范性
     * @return list
     * @throws Exception 异常
     */
    <E> List<E> query(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception;

    /**
     * 插入
     *
     * @param configuration
     * @param mappedStatement
     * @param object
     * @throws Exception 异常
     */
    void insert(Configuration configuration, MappedStatement mappedStatement, Object object) throws Exception;

    /**
     * 更新
     *
     * @param configuration
     * @param mappedStatement
     * @param object
     * @return
     */
    int update(Configuration configuration, MappedStatement mappedStatement, Object object) throws Exception;

    /**
     * 删除
     *
     * @param configuration
     * @param mappedStatement
     * @param object
     * @return
     */
    int delete(Configuration configuration, MappedStatement mappedStatement, Object object) throws Exception;

}
